package njupt.vo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;



public class Cart {
	private Map<String,Integer> cart =new HashMap<String,Integer>();
	
	//public Map<Float, Integer> getPricelist() {
	//	return pricelist;
	//}
	
	
	private Float totalprice;
	private List<String> idlist;
	
	public List<String> getIdlist() {
		return idlist;
	}
	public void setIdlist(List<String> idlist) {
		this.idlist = idlist;
	}
	public Float getTotalprice() {
		return totalprice;
	}
	public void setTotalprice(Float totalprice) {
		this.totalprice = totalprice;
	}
	private List<String> namelist=new ArrayList<String>();
	private List<Integer> shulianglist=new ArrayList<Integer>();
	public List<Integer> getShulianglist() {
		return shulianglist;
	}
	public void setShulianglist(List<Integer> shulianglist) {
		this.shulianglist = shulianglist;
	}
	public List<String> getNamelist() {
		return namelist;
	}
	public void setNamelist(List<String> namelist) {
		this.namelist = namelist;
	}
	public List<Float> getPricelist() {
		return pricelist;
	}
	public void setPricelist(List<Float> pricelist) {
		this.pricelist = pricelist;
	}
	public List<Integer> getCuxiaolist() {
		return cuxiaolist;
	}
	public void setCuxiaolist(List<Integer> cuxiaolist) {
		this.cuxiaolist = cuxiaolist;
	}
	private List<Float> pricelist=new ArrayList<Float>();
	private List<Integer> cuxiaolist=new ArrayList<Integer>();
	private int chuxiao;
	private float goodsprice;
	public int getChuxiao() {
		return chuxiao;
	}
	public void setChuxiao(int chuxiao) {
		this.chuxiao = chuxiao;
	}
	private int goodscartcount;
	public int getGoodscartcount() {
		return goodscartcount;
	}
	public void setGoodscartcount(int goodscartcount) {
		this.goodscartcount = goodscartcount;
	}

	public Map<String,Integer> getcart(){
		return cart;                              //获取购物车信息
	}
public void addcart(String goodsid){                //添加到购物车若是第一次，map value设置为1，有添加过的，map value+1
	if(cart.containsKey(goodsid)){
		cart.put(goodsid,cart.get(goodsid));
		System.out.println("cart.get"+cart.get(goodsid));
	}
	else{cart.put(goodsid,1);}	
	   System.out.println("还是头一次"+cart.get(goodsid));
    }
public void deletecart(String goodsid){
	if(cart.containsKey(goodsid)){
		cart.put(goodsid,0);
		cart.remove(goodsid);
	}
}

}